﻿using DMC.Core.Models.Dto;
using DMC.Core.Models.Queries;
using DMC.Core.Models.VO;
using DMC.Core.Services;
using Microsoft.AspNetCore.Mvc;
using MiniFox.Infrastructure;
using MiniFox.Platform.Applications.Web;
using MiniFox.Platform.Scripting;
using MiniFox.Utility;
using MiniFox.Web.Filters;
using MiniFox.Web.Infrastructure;

namespace DMC.Web.Controllers
{
    [NoCache, ValidationFilter, Area(GlobalConstants.AREA_NAME)]
    public class CommandController : AuthorizedController<ICommandService>
    {
        [HttpPost]
        public Response Test([FromBody] CommandTestDto request)
        {
            request.CommandText = request.CommandText.Resolve(this.HttpContext.GetAuthState());
            var result = this.Component.Test(request);
            var response = result.CreateResponse();
            return response;
        }
    }
}
